#!/bin/sh
#
#  HITACHI VANTARA PROPRIETARY AND CONFIDENTIAL
#
#  Copyright 2002 - 2018 Hitachi Vantara. All rights reserved.
#
#  NOTICE: All information including source code contained herein is, and
#  remains the sole property of Hitachi Vantara and its licensors. The intellectual
#  and technical concepts contained herein are proprietary and confidential
#  to, and are trade secrets of Hitachi Vantara and may be covered by U.S. and foreign
#  patents, or patents in process, and are protected by trade secret and
#  copyright laws. The receipt or possession of this source code and/or related
#  information does not convey or imply any rights to reproduce, disclose or
#  distribute its contents, or to manufacture, use, or sell anything that it
#  may describe, in whole or in part. Any reproduction, modification, distribution,
#  or public display of this information without the express written authorization
#  from Hitachi Vantara is strictly prohibited and in violation of applicable laws and
#  international treaties. Access to the source code contained herein is strictly
#  prohibited to anyone except those individuals and entities who have executed
#  confidentiality and non-disclosure agreements or other agreements with Hitachi Vantara,
#  explicitly covering such access.

###
# setting JVM mem for current shell and all processes started from current shell
# TODO parameterize xms/xmx values
###
export PENTAHO_DI_JAVA_OPTIONS="-Xms512m -Xmx1024m"
echo "[PDI-CONTENT-EXECUTOR-JOB] PENTAHO_DI_JAVA_OPTIONS: $PENTAHO_DI_JAVA_OPTIONS"

echo "[CDA] REPOS_URL: $REPOS_URL"
echo "[CDA] REPOS_USER: $REPOS_USER"
echo "[CDA] REPOS_PASSWORD: $REPOS_PASSWORD"

export OPT="$OPT -Drepos.url=$REPOS_URL -Drepos.user=$REPOS_USER -Drepos.password=$REPOS_PASSWORD"

INITIALDIR="`pwd`"
BASEDIR="`dirname $0`"
cd "$BASEDIR"
DIR="`pwd`"
cd - > /dev/null

if [ "$1" = "-x" ]; then
  set LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BASEDIR/lib
  export LD_LIBRARY_PATH
  export OPT="-Xruntracer $OPT"
  shift
fi

"$DIR/spoon.sh" -main org.pentaho.di.scale.Scale "$@"
